/***********************************************************************
 * 
 *  This file is a part of Minesweeper - a computer game
 *  Copyright (C) 2020, 2021 Andrew Tokarskiy <tokarskiy.a@keemail.me>
 *  
 *  This program is free software: you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation, either version 3 of the License, or
 *  (at your option) any later version.
 *  
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *  
 *  You should have received a copy of the GNU General Public License
 *  along with this program.  If not, see <http://www.gnu.org/licenses/>
 * 
*************************************************************************/

#ifndef _MINES_H
#define _MINES_H

#define MINE_INDEX -1

#define STATUS_NULL -3
#define STATUS_FLAG -2
#define STATUS_MINE -1

#include <stddef.h>

typedef struct {
    // map: mine = -1, another number = amount of mines around
    int **map;
    int **statuses; 
    size_t width;
    size_t height; 
    int minesAmount; 
    int initialized; 
} Game;

Game* initGame(const size_t height, const size_t width, const int minesAmount);
void freeGame(Game* const  game); 

typedef enum {
    Click = 0, 
    MarkMine = 1,
} 
ActionType; 

typedef enum {
    Continue = 0,
    Lose = 1,
    Win = 2,
}
ActionResult; 

const ActionResult action(Game* const game, const size_t i, const size_t j, const ActionType actionType); 

#endif // _MINES_H
